<template>
	<view class="ml-4 bg-white" style="height: 100%;">
		<view class="flex flex-column" style="height: 35%">
			<view  class="m-4 flex align-center justify-center" style="height: 100%">
				<view class="flex justify-center align-center" style="height: 35%">
					<text class="fout-md font-weight-bold">欢迎来到合美供销云平台!</text>
				</view>
				<!-- <view class="" @click="goShopCart" style="display: flex;justify-content: center;padding-bottom: 20rpx;">
					进入购物车
				</view>
				<view class="flex align-end login-button" style="justify-content: space-around; height: 45%">
					<view @click="WeChat"
						class="flex justify-center align-center border-button bg-success border-success"
						style="cursor: pointer; width: 200rpx; height: 90%">
						<text class="text-white font">请登录</text>
					</view>
					<view class="hover flex justify-center align-center bg-white border-button border-success"
						style="width: 200rpx; height: 90%" @click="WeChat">
						<text class="font text-success">免费注册</text>
					</view>
				</view> -->
			</view>
			<!-- <view v-else class="m-4 flex align-center" style="height: 100%">
				<view class="flex-shrink rounded-circle justify-center align-center"
					style="width: 120rpx; height: 120rpx">
					<image src="/static/icon/tourist.png" class="rounded-circle border-button border-success"
						style="width: 120rpx; height: 120rpx" mode="aspectFit">
					</image>
				</view>
				<view class="flex px-2 flex-column justify-center position-relative" style="width: 100%; height: 100%">
					<view class="flex align-center" style="width: 390rpx; height: 50%">
						<text
							class="font-md text-ellipsis">Hi，{{ Name }}{{ enterprise_name?'('+enterprise_name+')':'(暂无认证信息)' }}</text>
					</view>

					<view class="flex align-start">
						<text @click="handleTabs" class="font-sm text-muted">进入个人中心</text>
						<text @click="handleExit" class="ml-4 font-sm text-muted" style="cursor: pointer">退出</text>
					</view>
				</view>
			</view> -->
		</view>
		<view class="px-9 py-4 flex justify-center align-center box border-top border-grey">
			<!-- <view class="flex flex-column justify-between" style="width: 100%">
				<view class="flex justify-center" style="width: 100%; height: 25%">
					<view class="flex justify-center align-center box border-success"
						style="border-bottom-width: 5rpx;border-bottom-style: solid;width: 40%;">
						<text class="font font-weight-bold text-success">服务热线</text>
					</view>
				</view>
		
				<view class="py-4 flex justify-center" style="55%">
	
					<view class="font-lg" style="color: green;font-weight: bold;">
						<uni-icons type="phone-filled" size="20" color="green"></uni-icons>400-9667-365
					</view>
				</view>
				<view class="flex QR">
					<view class="flex justify-center" style="width: 100%; height: 25%">
						<view class="flex justify-center align-center box border-success"
							style=" border-bottom-width: 5rpx;border-bottom-style: solid;width: 40%;">
							<text class="font font-weight-bold text-success">扫码登录</text>
						</view>
					</view>
					<MoreChannels></MoreChannels>
				</view>
			</view> -->
			<image src="../static/icon/wechat.png" style="width: 200px; height: 200px;" mode="aspectFit" />
		</view>
		
	</view>
</template>

<script>
	const app = getApp();
	import MoreChannels from "@/components/More_Channels.vue"
	export default {
		components: {
			MoreChannels,
		},
		name: "loginPC",
		data() {
			return {
				isLogin: uni.getStorageSync('loginInfo').token ? true : false,
				screenWidth: uni.getSystemInfoSync().windowWidth,
				// isLogin:true,
				enterprise_name: '',
				Name: '',
				Domain_WZYM: app.globalData.Domain_WZYM,
				
				shop_Info: {},
			};
		},
		props: {
			shopInfo: {
				default: '',
				type: String,
			}
		},
		methods: {
			// 进入购物车
			goShopCart(){
				uni.navigateTo({
					url: '/pages/shopCart/shopCart',
				});
			},
			handleTabs() {
				window.location.href =app.globalData.Domain_WZYM+'/dist/h5XKLJ/#/pages/backend/index?loginInfo='+JSON.stringify(this.shop_Info)
			},
			handleExit() {
				uni.removeStorageSync('loginInfo');
				this.isLogin = false
				// window.location.href = 'http://localhost:8081/dist/h5XKLJ/#/'
				window.location.href = app.globalData.Domain_WZYM+'/dist/h5XKLJ/#/pages/login/login?shopname="shop"'
			
			},
			Login() {
				window.location.href = app.globalData.Domain_WZYM+'/dist/h5XKLJ/#/pages/login/login?shopname="shop"';

			},
			Register() {
				window.location.href = app.globalData.Domain_WZYM+'/dist/h5XKLJ/#/pages/login/register?shopname="shop"';

			},
			WeChat(){
				this.$emit('WeChat')
			}
		},
		// onLoad(e) {
		// 	console.log('logininfo',e);
		// 	if (e.hasOwnProperty(loginInfo)) {
		// 		let loginInfo = JSON.parse(e.loginInfo);
		// 		this.isLogin = true;
		// 		this.Phone = uni.getStorageSync("loginInfo").use.slice(7, 11);
		// 		this.Name = uni.getStorageSync("loginInfo").username;
		// 		this.enterprise = uni.getStorageSync("loginInfo").enterprise
		// 		this.enterprise_name = uni.getStorageSync("loginInfo").enterprise_name
		// 	}else {
		// 		this.isLogin = false;
		// 	}
		// }
		mounted() {
			if(this.shopInfo!=''){
				this.shop_Info = JSON.parse(this.shopInfo)
				this.shop_Info.shopFlag=true
			}
			console.log(this.shop_Info.shopFlag, 'loginInfo');
			if (Object.keys(this.shop_Info).length == 0) {
				this.isLogin = false;
			} else {
				//本地存储地址
				let loginInfo = this.shop_Info;
				this.isLogin = true;
				this.Phone = loginInfo.use.slice(7, 11);
				this.Name = loginInfo.username;
				this.enterprise = loginInfo.enterprise
				this.enterprise_name = loginInfo.enterprise_name
			}

		}
	}
</script>

<style lang="scss">
	.QR {
		//   justify-content: space-between;
		flex-direction: column;

		.code {
			justify-content: space-between;
		}

		view {
			image {
				width: 120rpx;
				height: 120rpx;
			}
		}
	}
</style>